home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C/C++ Users Group Library 1996 July
/
C-C++ Users Group Library July 1996.iso
/
vol_300
/
347_01
/
tavl_sdt.c
< prev
next >
Wrap
C/C++ Source or Header
|
1991-04-25
|
798b
|
29 lines
/*:file:version:date: "%n V.%v; %f"
* "TAVL_SDT.C V.10; 27-Apr-91,12:16:20"
*
* Purpose: Change data in existing node.
*
* Released to the PUBLIC DOMAIN
*
* Author: Bert C. Hughes
* 200 N.Saratoga
* St.Paul, MN 55104
* Compuserve 71211,577
*/
#include "tavltree.h"
int tavl_setdata(TAVL_treeptr tree, TAVL_nodeptr p, void *item)
{
if (Is_Head(p)) return(TAVL_ILLEGAL_OP);
if ((*tree->cmp)((*tree->key_of)(p->dataptr),(*tree->key_of)(item)))
return(TAVL_ILLEGAL_OP); /* Don't allow identifier to change! */
(*tree->free_item)(p->dataptr);
p->dataptr = (*tree->make_item)(item);
return(p->dataptr ? TAVL_OK : TAVL_NOMEM);
}